$(function () {
    getUrl('accounterCenter/myCard', 'accounterCenter/writeCardInfm');
    var bank = '';
    var bankType = '';
    $(".choose").click(function () {
        $(".choose").attr("src", "/Lvscore_User_M/userWeb/static/images/unchoose.png");
        $(this).attr("src", "/Lvscore_User_M/userWeb/static/images/choosed.png");
        $("#option1").prop('selected', 'selected');
        bank = $(this).prop('title');
    });
    $(".bankLogo").click(function(){
        $(".choose").attr("src", "/Lvscore_User_M/userWeb/static/images/unchoose.png");
        $(this).parent().parent().find($(".choose")).attr("src", "/Lvscore_User_M/userWeb/static/images/choosed.png");
        $("#option1").prop('selected', 'selected');
        bank = $(this).prop('title');
    })
    $(".cardType").click(function(){
        $(".chooseType").attr("src", "/Lvscore_User_M/userWeb/static/images/unchoose.png");
        $(this).parent().find($(".chooseType")).attr("src", "/Lvscore_User_M/userWeb/static/images/choosed.png");
        bankType = $(this).prop('title');
    })
    $(".chooseType").click(function () {
        $(".chooseType").attr("src", "/Lvscore_User_M/userWeb/static/images/unchoose.png");
        $(this).attr("src", "/Lvscore_User_M/userWeb/static/images/choosed.png");
        bankType = $(this).prop('title');
    });
    $("#otherBank").change(function () {
        $(".choose").attr("src", "/Lvscore_User_M/userWeb/static/images/unchoose.png");
        bank = $(this).val();
    });

    $('.nextstep').click(function () {
        if (!isNotEmpty(bank))
            alertBox('请选择银行卡发卡行', '');
        else {
            if (!isNotEmpty(bankType))
                alertBox('请选择银行卡类型', '');
            else {
                var bankJson = encodeURIComponent(bank);
                var bankTypeJson = encodeURIComponent(bankType);
                var cookie = new sweetCookie();
                cookie.setCookie('bank', bankJson, 60 * 1000 * 10);
                cookie.setCookie('bankType', bankTypeJson, 60 * 1000 * 10);
                window.location.href = '/Lvscore_User_M/userWeb/views/accounterCenter/writeCardInfm.html';
            }
        }
    });

});

